package com.itheima.jdk8date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Test04 {

    public static void main(String[] args) {

        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
        String format = now.format(formatter);
        System.out.println(now);
        System.out.println(format);

        StringBuilder sb= new StringBuilder("2050年02月15日 10时05分18秒");
        LocalDateTime parse = LocalDateTime.parse(sb, formatter);
        System.out.println(parse);

        LocalDate now1 = LocalDate.now();
        String format1 = now.format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
        System.out.println(format1);
    }
}
